/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-12-07 09:26:03
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-03-14 16:39:33
 * @FilePath: /yt-devops/lib/components/yt_form/utils/form_widget_utils.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:yt_devops/styles/styles.dart';
import 'package:bruno/src/components/form/utils/brn_form_util.dart';

class FormWidgetUtils {
  static Widget getTitleWidget(
    String labelText, {
    double? width,
    TextStyle? labelStyle,
  }) {
    return Container(
      width: width,
      alignment: Alignment.centerLeft,
      child: Text(
        labelText,
        style: labelStyle ?? TextStyles.f16,
      ),
    );
  }

  static Widget getHeadTitleWidget(String labelText,
      {TextStyle? labelStyle, bool required = false}) {
    return Container(
        alignment: Alignment.centerLeft,
        padding: const EdgeInsets.only(bottom: 5),
        height: 50,
        child: Row(
          children: [
            getStar(required),
            Text(
              labelText,
              style: labelStyle,
            )
          ],
        ));
  }

  static Widget getStar(bool required) {
    return SizedBox(
      width: 12.w,
      child: required
          ? Text(
              '＊',
              textAlign: TextAlign.left,
              style: TextStyles.f12.warningColorStyle,
            )
          : null,
    );
  }

  static Widget getRightArrowIcon() {
    return Container(
        alignment: Alignment.center,
        child: Image.asset(
          'assets/images/icon_right_arrow.png',
          width: 24,
          height: 24,
        ));
  }
}
